<% include ../../header.ejs %>

  <div class="container-fluid">
    <div class="row">
      <% include ../../sidebar.ejs%>
        <div class="col-md-9">
          <h3>文章列表</h3>
          <table class="table col-md-12">
            <tr>
              <th>id</th>
              <th>缩略图</th>
              <th>标题</th>
              <th>操作</th>
            </tr>
            <% for(var i=0;i<data.length;i++){
                var item = data[i];
                %>
              <tr>
                <td>
                  <%=item.aid%>
                </td>
                <td>
                  <img style="width:60px;height:60px;" src="<%=item.avatar%>" alt="">
                </td>
                <td>
                  <%=item.title%>
                </td>
                <td>
                  <a href="/article/edit/<%=item.aid%>" class="btn btn-success btn-xs">编辑</a>
                  <a href="/article/del/<%=item.aid%>" class="btn btn-danger btn-xs">删除</a>
                </td>
              </tr>
              <%}%>

          </table>
          <nav aria-label="Page navigation">
            <ul class="pagination">
              <%if(page!=0){%>
                <li>
                  <a href="/article/list/<%=page-1%>" aria-label="Previous">
                    <span aria-hidden="true">&laquo;</span>
                  </a>
                </li>
                <%}%>
                  <%for(var i=0;i<pages;i++){%>
                    <li <%if(page==i){%>class="active"
                      <%}%> >
                        <a href="/article/list/<%=i%>">
                          <%=i+1%>
                        </a>
                    </li>
                    <%}%>
                      <%if(page!=pages-1){%>
                        <li>
                          <a href="/article/list/<%=(parseInt(page)+1)%>" aria-label="Next">
                            <span aria-hidden="true">&raquo;</span>
                          </a>
                        </li>
                        <%}%>
            </ul>
          </nav>
        </div>
    </div>

  </div>


  <% include ../../footer.ejs%>
